#!/usr/bin/env python

PACKAGE = "inudev_ros_nodelet"

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()

verbosegroup = gen.add_group("Verbose", type="apply")

verbosegroup.add("video_verbose", bool_t, 0, "Verbose Video frame receiving info", False)
verbosegroup.add("depth_verbose", bool_t, 0, "Verbose Depth frame receiving info", False)
verbosegroup.add("disparity_verbose", bool_t, 0, "Verbose Disparity frame receiving info", False)
verbosegroup.add("pointcloud_verbose", bool_t, 0, "Verbose PointCloud frame receiving info", False)
verbosegroup.add("webcam_verbose", bool_t, 0, "Verbose WebCam frame receiving info", False)
verbosegroup.add("fisheye_verbose", bool_t, 0, "Verbose Fisheye frame recieving info", False)
verbosegroup.add("slam_verbose", bool_t, 0, "Verbose Slam frame recieving info", False)
verbosegroup.add("imu_verbose", bool_t, 0, "Verbose IMU frame receiving info", False)
verbosegroup.add("object_detection_verbose", bool_t, 0, "Verbose OD frame receiving info", False)
verbosegroup.add("feature_tracking_verbose", bool_t, 0, "Verbose features frame receiving info", False )

Projector_enum = gen.enum([
                       gen.const("ProjectorOff", int_t, 0, "Projector mode: power off"),
                       gen.const("ProjectorLow", int_t, 1, "Projector mode: low power"),
                       gen.const("ProjectorHigh", int_t, 2, "Projector mode: High power(default)")
                     ],
                  "Projector power control")
gen.add("Projector_Power", int_t, 2, "Projector power control", 1, 0, 2, edit_method=Projector_enum)

sensorcontrolgroup = gen.add_group("Sensor_Control_Settings", type="apply")

sensorcontrolgroup.add("Auto_Sensor_Control", bool_t, 0, "Auto exposure on/off flag", True)
sensorcontrolgroup.add("Sensor_ID", int_t, 0, "SensorID for exposure control", 1, 0, 10)
sensorcontrolgroup.add("Exposure", double_t, 0, "Exposure time control", 3500, 0, 7000)
sensorcontrolgroup.add("Gain", double_t, 0, "SensorID for exposure control", 25, 0, 50)
sensorcontrolgroup.add("Use_ROI", bool_t, 0, "Auto exposure on/off flag", False)
sensorcontrolgroup.add("ROI_Top_Left_x", int_t, 0, "Auto Exposure ROI top left X position", 0, 0, 1028)
sensorcontrolgroup.add("ROI_Top_Left_y", int_t, 0, "Auto Exposure ROI top left y position", 0, 0, 1028)
sensorcontrolgroup.add("ROI_Bottom_Right_x", int_t, 0, "Auto Exposure ROI bottom right X position", 400, 0, 1028)
sensorcontrolgroup.add("ROI_Bottom_Right_y", int_t, 0, "Auto Exposure ROI bottom right Y position", 400, 0, 1028)

depthgroup = gen.add_group("Depth_Settings", type="apply")

depthgroup.add("Depth_channel_ID", int_t, 0, "Depth channel ID (Typically 3 or 5)", -1, -1, 10)
depthgroup.add("Depth_output_format", int_t, 0, "-1 - Default (Depth), 0 - depth, 1 - disparity , 2 - pointcloud, 3- RGB, 4 - registered, 5- Raw", -1, -1, 5)
depthgroup.add("Depth_registration_channel", int_t, 0, "RGB channel to register, Default: -1 (verify that output format is registered)", -1, -1, 10)

depthgroup.add("Temporal_Filter_SDK", bool_t, 0, "Temporal Filter on/off flag", False)
depthgroup.add("Temporal_Filter_ROS", bool_t, 0, "Temporal Filter on/off flag", False)
depthgroup.add("Temporal_BufferFrames", int_t, 6, "BufferFrames", 6, 4, 15)
depthgroup.add("Temporal_ProcessAllPixel", bool_t, 0, "Process All Pixel on/off flag", False)
depthgroup.add("Temporal_Threads", int_t, 1,  "Threads to process", 1, 1, 4)

depthgroup.add("Temporal_Filter2_ROS", bool_t, 0, "Temporal Filter2 on/off flag", False)
depthgroup.add("Temporal_Filter2_mode", int_t, 2, "Temporal Filter2 mode", 2, 1, 8)
depthgroup.add("Temporal_Filter2_alpha", int_t, 40, "Temporal Filter2 alpha", 40, 1, 100)
depthgroup.add("Temporal_Filter2_delta", int_t, 1,  "Temporal Filger2 delta", 20, 1, 200)

depthgroup.add("Passthrough_Filter_ROS", bool_t, 0, "Passthrough Filter on/off flag", False)
depthgroup.add("Passthrough_Filter_SDK", bool_t, 0, "Passthrough Filter on/off flag", False)
depthgroup.add("PT_zmin", int_t, 40,  "Passthrough Filter ZMin", 40, -1, 8000)
depthgroup.add("PT_zmax", int_t, -1,  "Passthrough Filter ZMax", 6000, -1, 8000)
depthgroup.add("PT_xmin", int_t, -1,  "Passthrough Filter ZMin", -1, -1, 8000)
depthgroup.add("PT_xmax", int_t, -1,  "Passthrough Filter ZMax", -1, -1, 8000)
depthgroup.add("PT_ymin", int_t, -1,  "Passthrough Filter ZMin", -1, -1, 8000)
depthgroup.add("PT_ymax", int_t, -1,  "Passthrough Filter ZMax", -1, -1, 8000)



depthgroup.add("Hole_Fill_SDK", bool_t, 0, "Fill Small Invalid on/off flag", False)
depthgroup.add("Hole_Fill_ROS", bool_t, 0, "Fill Small Invalid on/off flag", False)
depthgroup.add("HF_maxradius", int_t, 25,  "max radius", 25, 20, 100)


depthgroup.add("Outlier_Remove_SDK", bool_t, 0, "Remove Small outlier on/off flag", False)
depthgroup.add("Outlier_Remove_ROS", bool_t, 0, "Remove Small outlier on/off flag", True)
depthgroup.add("OR_percent", int_t, 1,  "threshold of max component to remove", 10, 1, 500)
depthgroup.add("OR_mindist", int_t, 1,  "min dist(z,mm) between components", 45, 1, 5000)
depthgroup.add("OR_maxremove", int_t, 1,  "max pixels number", 50, 10, 500)


depthgroup.add("Edge_Preserve_ROS", bool_t, 0, "Edge Preserve Filter on/off flag", False)
depthgroup.add("EP_alpha", int_t, 1,  "the weight of the current pixel for smoothing is bounded within [25..100]%", 50, 25, 100)
depthgroup.add("EP_delta", int_t, 1,  "The depth gradient below which the smoothing will occur as number of depth levels [1..50]%", 20, 1, 50)
depthgroup.add("EP_iter", int_t, 1,  "the number of iterations for smoothing is bounded within [1..5]", 2, 1, 5)

depthgroup.add("PC_scale", int_t, 1,  "3D coordinate divided by", 1000, 1, 1000)
depthgroup.add("PC_order", bool_t, 1, "Whether output order point cloud", True)
depthgroup.add("Simplify_2", bool_t, 0, "Whether simplify two times ", False)

depthgroup.add("Show_Color", bool_t, 0, "Show Color on/off flag", False)

depthgroup.add("Confidence", int_t, 0,  "confidence of depth value", 0, 0, 15)


rgbgroup = gen.add_group("RGB_Settings" , type="apply")

rgbgroup.add("RGB_channel_ID", int_t, 0, "RGB channel ID (Typically 4 or 9)", -1, -1, 10)
rgbgroup.add("RGB_output_format", int_t, 0, "# 0 - BGRA, on Android RGBA , 1 - RAW , 2 - BGRA, 3- RGBA, 4 - BGR", 0, 0, 4)
rgbgroup.add("RGB_post_processing", int_t, 0, "# 1 - Registered, 2 - Undistorted, 4 - GammaCorrect", 0, 0, 7)
rgbgroup.add("RGB_registration_channel", int_t, 0, "# Depth channel to register, Default: -1 (verify that output format is registered)", -1, -1, 10)

pclgroup = gen.add_group("PCL_Settings" , type="apply")

pclgroup.add("PCL_RGB_channel_ID", int_t, -1, "RGB channel ID (Typically 0, 4 or 9)", -1, -1, 10)
pclgroup.add("PCL_output_format", int_t, 0, "# 0 - None, 1 - Registered ", 0, 0, 1)
pclgroup.add("PCL_filter", bool_t, 0, "Point cloud filter", False)
pclgroup.add("PCL_virtual_wall", bool_t, 0, "Add a PCL virtual wall", False)
pclgroup.add("Virtual_wall", int_t, 2000, "wall in front(Default 2000mm)", 2000, 0, 8000)

slamgroup = gen.add_group("SLAM_Settings" , type="apply")
slamgroup.add("SLAM_Vector_Size", int_t, 0, "SLAM path size, Endless path is the default: -1", -1, -1, 10000)

exit(gen.generate(PACKAGE, "inudev_ros_nodelet", "inudev_ros_nodelet"))


